﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using HalconDotNet;
using Halcon二次开发.Model;
using Halcon二次开发.Model.储放所有单例.储存每个单例界面;
using Halcon二次开发.Model.自定义控件;

namespace Halcon二次开发.View.图片显示弹窗
{
    public partial class ImageNgForm : Form
    {
        public static ImageNgForm ngForm;
        public static ImageNgForm GetSingle() {
            if (ngForm==null)
            {
                ngForm = new ImageNgForm();
            }
            return ngForm;
        }
        ImageNgForm() {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            hSmartWindowControl1.MouseWheel += HSmartWindowControl1_MouseWheel;
        }

        public ImageNgForm DispImage(HObject hObject,string title) {
            hSmartWindowControl1.HalconWindow.ClearWindow();
            hSmartWindowControl1.HalconWindow.DispObj(hObject);
            hSmartWindowControl1.SetFullImagePart();
            ngForm.Text = title + "_任务_出错！！！";
            return ngForm;
        }
       /// <summary>
       /// 继续，复位所有工位
       /// </summary>
       /// <param name="sender"></param>
       /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                (FormDb.Db["Form1"] as Form1).toolStripMenuItem3_Click(sender, e);
                this.Close();
            }
            catch
            {

            }
        }
        private void HSmartWindowControl1_MouseWheel(object sender, MouseEventArgs e)
        {
            hSmartWindowControl1.HSmartWindowControl_MouseWheel(sender, e);
        }

        private void ImageNgForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }
    }
}
